import 'package:flutter/material.dart';
import 'package:x3_component_core/components/button_components/base_icon_button.dart';

class BaseSharedDialogComponent extends StatelessWidget {
  BaseSharedDialogComponent({Key key, @required this.title, @required this.height, @required this.child}) : super(key: key);

  final Widget child;

  final double height;

  final String title;

  @override
  Widget build(BuildContext context) {
    return Dialog(
      child: Container(
        padding: const EdgeInsets.fromLTRB(20, 12, 20, 20),
        height: height,
        decoration: new BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(4.0),
        ),
        child: Column(
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(this.title, style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 15)),
                BaseIconButton(
                  icon: Icons.close,
                  onPress: () => Navigator.of(context, rootNavigator: true).pop(),
                ),
              ],
            ),
            SizedBox(height: 20),
            Expanded(
              child: this.child,
            ),
          ],
        ),
      ),
    );
  }
}
